<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="${c.module.totalPackage}.${c.module.moduleName}.entity">
    <class name="${c.name}" table="${c.table}">
        <id name="id" type="java.lang.Long">
            <column name="ID" />
            <generator class="sequence">
				<param name="sequence">SEQ_${c.table}</param>
            </generator>
        </id>
        <#list c.oneToOne as o>
        <#if o.inverse == "false">
        <many-to-one name="${o.name}" class="${o.className}" fetch="select" unique="true">
            <column name="${o.column}" not-null="true" />
        </many-to-one>
        <#else>
        <one-to-one name="${o.name}" class="${o.className}" property-ref="${o.refProperty}" />
        </#if>
        </#list>
        <#list c.manyToOne as mo>
        <many-to-one name="${mo.name}" class="${mo.className}" fetch="select">
            <column name="${mo.column}" not-null="true" />
        </many-to-one>
        </#list>
        <#list c.oneToMany as om>
        <set name="${om.name}" table="${c.camelToTable(om.className,c.prefix)}" inverse="true" lazy="true" fetch="select">
            <key>
                <column name="${c.camelToTable(c.name)}_ID" not-null="true" />
            </key>
            <one-to-many class="${om.className}" />
        </set>
        </#list>
        <#list c.properties as p>
        <property name="${p.name}" type="<#if p.type == "String">string<#elseif p.type == "Long">java.lang.Long<#elseif p.type == "Date">timestamp</#if>">
            <column name="${p.column}"<#if p.type == "String"> length="${p.length}"<#elseif p.type == "Date"> length="23"</#if><#if p.notNull == "true"> not-null="true"</#if><#if p.unique == "true"> unique="true"</#if> />
        </property>
        </#list>
        
        <property name="status" type="string">
            <column name="STATUS" length="1" not-null="true" />
        </property>
        <property name="createdUser" type="java.lang.Long">
            <column name="CREATED_USER" not-null="true" />
        </property>
        <property name="createdDate" type="timestamp">
            <column name="CREATED_DATE" length="23" not-null="true" />
        </property>
        <property name="updatedUser" type="java.lang.Long">
            <column name="UPDATED_USER" />
        </property>
        <property name="updatedDate" type="timestamp">
            <column name="UPDATED_DATE" length="23" />
        </property>
    </class>
</hibernate-mapping>
